<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<script>
	var ctx = "${ctx}";
</script>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>找回密码</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
	<meta http-equiv="expires" content="Wed, 26 Feb 209908:21:57 GMT"> 
   
	<link href="${ctx}/static/css/bootstrap.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/font-awesome.min.css?v=4.4.0?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/animate.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/style.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/common.css?v=${static_version}" rel="stylesheet" />
	<link href="//at.alicdn.com/t/font_9x03jhokyws9vn29.css" rel="stylesheet">
	<!-- Data Tables -->
	<link href="${ctx}/static/css/plugins/dataTables/dataTables.bootstrap.css?v=${static_version}" rel="stylesheet" />
    
</head>
<body  class="gray-bg">
 <!--顶部导航开始-->
        <div class="row border-bottom topmenu">
                <nav class="navbar navbar-fixed-top" role="navigation" style="margin-bottom: 0; border-bottom:1px solid #e7e7e7;">
                    <div class="navbar-header">
                        <form role="search"  class="navbar-form-custom" method="post" action="">
                            <div class="form-group">
                              <a href="#" style="padding-left:50px; display:block"><img src="${ctx}/static/img/logo.png" style="height:37px; margin-top:10px;" /></a>
                            </div>
                        </form>
                    </div>
                    <ul class="nav navbar-top-links navbar-right">
                        
                        <li class="hidden-xs">
                            <a href="index_v1.html" class="J_menuItem" data-index="0"><i class="fa fa-question-circle"></i>帮助中心</a>
                        </li>
                         <li class="dropdown hidden-xs">
                            <a class="right-sidebar-toggle" aria-expanded="false">
                               <i class="fa fa-book" aria-hidden="true"></i>使用手册
                            </a>
                        </li>
                      
                    </ul>
                </nav>
            </div>

	<!--header:end-->


	<div class="wrapper" style="margin-top:80px;">
<!--
	
		<div class="block register-progress text_center">
			<div class="progress-title"></div>
			<div class="apply-shop-progress progress-big">
				<div class="progress">
					<ol>
						<li class="progress-step active"><span
							class="progress-step-number"> <i
								class="uthink_icon icon_01"></i>
						</span><br> <span class="progress-step-into">填写手机号</span></li>
						<li name="stepli2" class="progress-bar" style="width: 150px;"></li>
						<li name="stepli2" class="progress-step"><span
							class="progress-step-number"><i class="uthink_icon icon_F"></i></span><br>
							<span class="progress-step-into">重新设置密码</span></li>
					</ol>
				</div>
				<div style="clear: both;"></div>
			</div>
		</div>
-->
<style type="text/css">
.register-div-form{}
.auto{margin:0 auto}
.text_center{ text-align:center;}
.control-group{ width: 300px; margin:10px auto; position: relative}
.control-group input[type="text"]{ display:block; height: 35px; line-height: 35px; text-indent: 10px; font-size: 14px; width: 100%;}
.control-group input[type="button"]{ width: 150px; margin: 0 auto}
.control-group  h2{ margin-bottom:40px;}
	.code{ position:absolute}
</style>
		<div class="col-md-10 register-div-form auto">
			<form id="shopregister-form" class="form form-aligned register-form"
				novalidate="true">
				<div id="step1" class="auto">
					<div class="control-group text_center">
						<h2 style="margin-left: 40px;">用户账号</h2>
						<div></div>
					</div>
					<div class="control-group auto">
						<input id="c_mob" type="text" name="c_mob" placeholder="输入手机号"
							required="" class="shop-name" value="">
					</div>
					
					<div class="control-group auto">
						<input id="code" name="code" type="text" placeholder="输入验证码" required=""
							class="shop-name" value=''>&nbsp;&nbsp;<input value="获取验证码"
							type="button" id="code_label" onclick="get_code()">
					</div>
					<div class="control-group auto">
						<input type="button" onclick="next1()" class="btn btn-danger btn-medium" value="下一步">

					</div>
				</div>
				
				
				<div id="step2" style="display: none;">
					<div class="control-group text_center">
						<h2 style="margin-left: 40px;">设置密码</h2>
						<div>为了您的账户安全，设置密码后请重新登录</div>
					</div>
					<div class="control-group">
						<input name="newpwd" type="password" datatype="*"
							nullmsg="请输入密码" id="onePwd" placeholder="" value=''
							class="input-text">
					</div>
					<div class="control-group">
						<input type="password" datatype="*" nullmsg="请填写"
							name="renewpwd" id="twoPwd" placeholder="请再次输入密码" value='' class="input-text">
					</div>
					<div class="control-group">
						<input type="button" onclick="next2()" style="width: 200px"
							class="btn btn-danger btn-medium" value="提交">
					</div>
				</div>
				</fieldset>
			</form>
			<div id="errormsg" style="display: none;">申请成功，等待后台审核</div>
		</div>
		
	</div>

	<!-- /wrapper -->

<script src="${ctx}/static/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctx}/static/js/plugins/layer/layer.js?v=${static_version}"></script>
	<script type="text/javascript">

		var code; //存放发的验证码
		
		//手机验证码
		function get_code() {
			var phone = $("#c_mob").val();
			if(phone==""){
				alert("手机号不能为空");
				return;
			}
			$.ajax({
				type : "post",
				url : "${ctx}/forget",
				data : "cMob=" + phone,
				success : function(msg) {
					var info = eval('(' + msg + ')');
					if(info.code=="0000"){//成功
						code = info.information;
						$("#code_label").val("验证码已发送");
					}else{ //失败
						layer.msg(info.information, {
							icon : 2
						});
					}
				}
			})
		}
		// 发送验证码结束
		
		function next1(){
			var newcode = $("#code").val();
			var c_mob = $("#c_mob").val();
			if(c_mob==""||newcode==""){
				alert("手机号和验证码不能为空");
				return;
			}
			$.ajax({
				type:"post",
				async:false,
				url:"${ctx}/getCodeBymobile",
				data : "mob="+c_mob,
				success : function(msg) {
					var info = eval('(' + msg + ')');
					if (newcode==info) {
						$("#step1").hide();
						$("#step2").show();
						$("li[name='stepli2']").addClass("active");					
					} else {
						layer.msg("验证码错误", {
							icon : 2
						});
					}
				}
			})
			 
			
		}
		
		function next2(){
			var cPass = $("#onePwd").val();
			var rPass = $("#twoPwd").val();
			if(cPass==""||rPass==""){
				alert("密码不能为空");
				return;
			}
			if(cPass!=rPass){
				alert("密码不一次");
				return;
			}
			$.ajax({
				type:"post",
				url:"${ctx}/user_forgetpwd_reset",
				data : $("#shopregister-form").serialize(),
				error : function() {
					layer.msg('操作失败', {icon:5,time:1000});
				},
				success : function(msg) {
						layer.msg("密码修改成功，请登录", {
							icon : 1,
							time: 3000
						}, function(){
							window.location.href="${ctx}/login";
						});						
					
			
				
				}
			})
		}
	
	</script>
</body>
</html>